package model;

import static org.junit.Assert.*
import model.agent.Firm

import org.junit.After
import org.junit.AfterClass
import org.junit.Before
import org.junit.BeforeClass
import org.junit.Test

class FirmTest extends GroovyTestCase{

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public final void testSell() {
		Firm f = new Firm()
		//f.addProperty("apple")
		f.mMoney = 0
		f.mIv = 5

		f.mPrice = 1
		f.mWage = 20
		f.mDm = 100
		f.mPosi = 0
		f.initMonth()
		
		//println f.prop
		assertEquals(1, f.sell(1), 3)
		assertEquals(4,f.dIv,3)

		assertEquals(4, f.sell(5),3)
		assertEquals(0,f.dIv,3)

		shouldFail(IllegalArgumentException){f.sell(-1)}

		//f.sell(null)

		//println f.prop

	}
}
